package cn.itsource;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import com.rabbitmq.client.Channel;

import java.io.IOException;

@Component
public class Rev {

    //监听email队列
    @RabbitListener(queues = {RabbitmqConfig.QUEUE_INFORM_EMAIL})
    public void receiveEmail(String msg, Message message, Channel channel) throws IOException {
        System.out.println("emial收到消息："+msg);
        //触发手动签收
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
    //监听sms队列
    @RabbitListener(queues = {RabbitmqConfig.QUEUE_INFORM_SMS})
    public void receive_sms(String msg, Message message, Channel channel) throws IOException {
        System.out.println("sms收到消息："+msg);
        //触发手动签收
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }

}
